<template>
	<uv-navbar
	  :fixed="false"
	  :title="title"
	  left-arrow
	  @leftClick="$onClickLeft"
	/>
	<view>
		<view class="set-box bg-white">
			<uv-form :model="form" ref="uForm" labelWidth="80">
				<uv-form-item label="基本信息:"  prop="number" label-position="top">
					<view class="flex">
					</view>
				</uv-form-item>
				<uv-form-item label="名称:"  borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.name" border="none" />
				</uv-form-item>
				<uv-form-item label="联系电话:" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.mobile"  border="none" placeholder="暂无" />
				</uv-form-item>
				<uv-form-item label="等级:"  borderBottom>
					<uv-input disabled  disabledColor="#ffffff" v-model="form.level"   border="none" placeholder="暂无"  />
				</uv-form-item>
				<uv-form-item label="行业:" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.industry" border="none" placeholder="暂无" />
				</uv-form-item>
				<uv-form-item label="来源:" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.source" border="none" placeholder="暂无" />
				</uv-form-item>
				<uv-form-item label="标签:" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.tags" border="none" placeholder="暂无"/>
				</uv-form-item>
				<uv-form-item label="地址:" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="addressName" border="none" placeholder="暂无"  />
				</uv-form-item>
				<uv-form-item label="详细地址:"  borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.detailAddress" border="none" placeholder="暂无"  />
				</uv-form-item>
				<uv-form-item label="备注:" prop="sort" borderBottom>
					<uv-input disabled disabledColor="#ffffff" v-model="form.remark" type="textarea" border="none" placeholder="暂无"  />
				</uv-form-item>
				<uv-form-item label="跟进状态:" borderBottom>
					<uv-input  v-model="form.followStatus" placeholder="暂无" border="none" disabled disabledColor="#ffffff" />
				</uv-form-item>
			</uv-form>
		</view>
	</view>
</template>

<script setup>
import {
	ref,
	computed
} from 'vue'
import { onLoad,onShow ,onReady} from '@dcloudio/uni-app'
import {
  getDictData
} from '@/api/customer'
import {
  getClues
} from '@/api/clues'
import { formatDateTime } from '@/utils/util'
const title = ref('线索详情')
const labelPosition = ref('left')
const border = ref(false)
const fields = ref([])
const id = ref(0)
const addressName = ref('')
const form = ref({})

onLoad((e) => {
	id.value = e.id
	// 获取详情
	getData()
})

const purchaseTotalFormat = computed(() =>{
	if(form.value.purchaseTotal) {
		let num;
		if (form.value.purchaseTotal > 9999) { 
			num = (Math.floor(form.value.purchaseTotal / 100) / 100) + '万';
		} else if (form.value.purchaseTotal <= 9999 && form.value.purchaseTotal > -9999) {
			num = form.value.purchaseTotal 
		}
		return num;
	} else {
		return 0;
	}
})



const getData = async() => {
	let data = await getClues({id:id.value})
	form.value = data
	getBaseConfig()
}

const getBaseConfig = async() => {
	let data1= await getDictData({type:'customer_level'})
	let data2 = await getDictData({type:'customer_industry'})
	let data3 = await getDictData({type:'customer_source'})
	let data4 = await getDictData({type:'follow_status'})
	
	data1.forEach((dict) => {
		if (dict.value === form.value.level + '') {
		   form.value.level = dict.name
		}
	})
	data2.forEach((dict) => {
		if (dict.value === form.value.industry + '') {
		   form.value.industry = dict.name
		}
	})
	data3.forEach((dict) => {
		if (dict.value === form.value.source + '') {
		   form.value.source = dict.name
		}
	})
	data4.forEach((dict) => {
		if (dict.value === form.value.followStatus + '') {
		   form.value.followStatus = dict.name
		}
	})


}



</script>

<style lang="scss" scoped>
.set-box {
	padding: 0rpx 22rpx 80rpx;
	.cif-title {
		font-size: 30rpx;
		font-weight: 700;
		padding: 22rpx 0;
	}
  .option {
    .text {
      color: #747474;
      font-size: 26rpx;
      text-align: justify;
      padding-bottom: 15rpx;
    }
  }
}


</style>
